<?php
/* +----------------------------------------------------------------------
// | 	xaoam.com
// |	author:am
// |	gitee:https://gitee.com/xaoam/amAdmin
// |	email:hi@xaoam.com
// |	
// +----------------------------------------------------------------------*/
namespace app\admin\controller;
use think\Controller;
use think\Db;

class Index extends Base {

    public function initialize(){
        parent::initialize();
    }

    public function index(){
			return $this->fetch();    
    }
    public function win(){
	$this->assign('imageList',config('wallpapers'));
	$this->assign('tplList',config('template'));
			return $this->fetch();    
    }
    public function defaults(){
        return $this->fetch();
    }
	public function pic(){
		$data = request()->param('pic');
		$res = Db::name('user')->where('id',$this->user_info['id'])->update(['pic'=>$data]);
		if($res >= 0){
			app('session')->set('user_info.pic',$data);
			return json(['code'=>200,'msg'=>'头像修改成功!']);
		}
	}
	public function logout() {
	    session(null);
		app('session')->flush();
	    $this->redirect(url('login/index'));
	}
}
